package com.killLog.api;

import com.killLog.common.Result;
import com.killLog.service.RoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/role")
@Slf4j
public class RoleApi {
    /**
    依赖注入
    */
    @Autowired
    private RoleService roleService;
    /**
     * @Description: 获得指定角色的权限列表
     * @Param ro_id 
     * @return com.killLog.common.Result
    */
    @GetMapping("/module/{ro_id}")
    public Result getRoleModuleList(@PathVariable Integer ro_id){
        return Result.OK(roleService.getRoleModuleList(ro_id));
    }
    /**
     * @Description: 变更角色权限
     * @Param ro_id 
     * @Param moduleIds 
     * @return com.killLog.common.Result
    */
    @PutMapping("/module/{roId}")
    public Result confirmRoleModules(@PathVariable Integer roId, @RequestBody Integer[] moduleIds){
        roleService.confirmRoleModules(roId,moduleIds);
        return Result.OK();
    }
}
